package com.atzzgc.http;

import java.io.IOException;

import org.apache.http.client.ClientProtocolException;
import org.apache.log4j.Logger;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class QZ {
	/**
	* Logger for this class
	*/
	private static final Logger logger = Logger.getLogger(QZ.class);

	
	
	public void say() throws ClientProtocolException, IOException{
		String url = "http://dyxx.yangguedu.cn/";
		Document document = Jsoup.connect(url).get();
		Elements links = document.select("a[href]"); //带有href属性的a元素
		System.out.println("----");
	 	for (Element element : links) {
			Elements select = element.select("a[title$=简章]");
			String string2 = select.attr("href").toString();
			String string = select.toString();
			if (select !=null && select.size()>0) {
				System.out.println(string2);
				System.out.println(string);
				
			}
			
		}
		System.out.println("----");
		
	}
	
	
}
